﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RCloud.Data
{
    /// <summary>
    /// 更新电影Tags
    /// </summary>
    public class MovieTagsNewUpdateClass : Doo.DataClass.UpdateClass<REntities, MovieTagsNew>
    {
        /// <summary>
        /// 电影ID
        /// </summary>
        public long MovieID { get; set; }

        /// <summary>
        /// Tag
        /// </summary>
        public long TagID { get; set; }

        public override MovieTagsNew GetRecord(REntities container)
        {
            return container.MovieTagsNew.FirstOrDefault(r => r.MovieID == MovieID && r.TagID == TagID);
        }

        public override MovieTagsNew CreateRecord(REntities container)
        {
            var mg = new MovieTagsNew { MovieID = MovieID, TagID = TagID };
            container.AddToMovieTagsNew(mg);
            return mg;
        }
    }

    /// <summary>
    /// 更新电影Tags
    /// </summary>
    public class MovieTagsUpdateClass : Doo.DataClass.UpdateClass<REntities, MovieTags>
    {
        /// <summary>
        /// 电影ID
        /// </summary>
        public int MovieID { get; set; }

        /// <summary>
        /// Tag
        /// </summary>
        public long TagID { get; set; }

        public override MovieTags GetRecord(REntities container)
        {
            return container.MovieTags.FirstOrDefault(r => r.MovieID == MovieID && r.TagID == TagID);
        }

        public override MovieTags CreateRecord(REntities container)
        {
            var mg = new MovieTags { MovieID = MovieID, TagID = TagID };
            container.AddToMovieTags(mg);
            return mg;
        }
    }
}
